﻿<UserControl
    x:Class="BadHabit.Factory.Controls.EffortBar"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    
    xmlns:props="clr-namespace:BadHabit.Factory.Windows.Properties"
    
    x:Name="effortBar"
    
    SizeChanged="effortBar_SizeChanged"
    
    MinWidth="60" MinHeight="150"
    VerticalAlignment="Stretch"
    
    BorderThickness="0"
    Background="Transparent">
    
    <UserControl.Resources>
        <LinearGradientBrush x:Key="UnderWorkedBrush" StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="#FF0000" Offset="0"/>
            <GradientStop Color="#AA0000" Offset="1"/>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="UnderWorkedBorderBrush" Color="#AA0000"/>
        <LinearGradientBrush x:Key="OverWorkedBrush" StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="{StaticResource LightColor}" Offset="0"/>
            <GradientStop Color="{StaticResource NormalColor}" Offset="1"/>
        </LinearGradientBrush>
        <SolidColorBrush x:Key="OverWorkedBorderBrush" Color="{StaticResource NormalColor}"/>
        
        <LinearGradientBrush x:Key="GradientWhiteBrush" StartPoint="0,0" EndPoint="1,0">
            <GradientStop Color="#FFFFFF" Offset="0"/>
            <GradientStop Color="#EEEEEE" Offset="1"/>
        </LinearGradientBrush>
    </UserControl.Resources>
    
    
    
    
    
    <Grid VerticalAlignment="Stretch">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        
        <TextBlock
            Grid.Row="0"
            HorizontalAlignment="Center"
            Style="{StaticResource Label}"
            Foreground="{StaticResource DarkTextBrush}"
            TextWrapping="Wrap"
            Text="{x:Static props:Resources.Effort}"/>

        <Border
                x:Name="ruleBorder"
                Grid.Row="1"
                CornerRadius="4"
                Margin="4"
                Background="{StaticResource GradientWhiteBrush}"
                BorderThickness="1" BorderBrush="{StaticResource ProjectPanelBorderBrush}"
                Width="30" VerticalAlignment="Stretch">
            <Border.BitmapEffect>
                <DropShadowBitmapEffect Direction="315" Color="LightGray" ShadowDepth="3" Softness=".3"   />
            </Border.BitmapEffect>
            <Border               
                    x:Name="effortBorder"
                    CornerRadius="4"                    
                    BorderThickness="0" 
                    Background="{Binding ElementName=effortBar, Path=BarBrush}"
                    Width="30" Height="{Binding ElementName=effortBar, Path=ActualBarHeight}" VerticalAlignment="Bottom">
                <Border
                    x:Name="lastDayBar"
                    CornerRadius="0"                    
                    BorderThickness="0,0,0,1" 
                    Background="Transparent"
                    VerticalAlignment="Top"                                        
                    ToolTip="{Binding ElementName=effortBar, Path=TodayEffort}"
                    Width="30"
                    BorderBrush="{Binding ElementName=effortBar, Path=TodayBorderBrush}"
                    Height="{Binding ElementName=effortBar, Path=LastDayBarHeight}"/>
                        
            </Border>
        </Border>
        <Border
                Grid.Row="1"
                IsHitTestVisible="False"
                CornerRadius="5"
                Margin="0,10,4,10"
                BorderThickness="0" 
                Background="#FFFFFF"                
                Opacity=".2"
                Width="15" VerticalAlignment="Stretch" />

        <TextBlock
                Grid.Row="2"
                HorizontalAlignment="Center"
                Style="{StaticResource Label}"
                Foreground="{StaticResource DarkTextBrush}"
                Text="{Binding ElementName=effortBar, Path=ActualEffort, StringFormat={x:Static props:Resources.N_hrs}}"/>

    </Grid>
</UserControl>
